#!/bin/sh
#set -x

vpn_pid=`ps -ef |grep openvpn |grep -v grep |awk '{print $2}'`
pid_cnt=`ps -ef |grep openvpn |grep -v grep |awk '{print $2}' |wc -l`
if [ ${pid_cnt}x = 0x ]
then
echo `date` 'openvpn server not started ,try to start it ' |tee -a vpndaemon.log
nohup /usr/local/sbin/openvpn --config /etc/openvpn/server.conf &
echo `date` 'openvpn server   started  ' |tee -a vpndaemon.log
else
echo `date` 'openvpn server already  started  ' |tee -a vpndaemon.log
fi
